<template>
  <div>
    <router-view style="flex:1"></router-view>
    <!-- <div class="loading" v-if="loading" @androidback="back"></div> -->
  </div>
</template>

<script>
const globalEvent = weex.requireModule('globalEvent')
const eventModule = weex.requireModule('event')

export default {
  name: 'App',
  data() {
    return {
      loading: false
    }
  },
  created() {
    globalEvent.addEventListener('androidback', ()=>{
      this.loading = true
      setTimeout(() => {
      // this.$router.back()
      this.$router.go(-1)
      this.loading = false
      }, 100)
    })
    // let objThis = this
    // globalEvent.addEventListener('androidback', function (e) {
    //   if(objThis.$route.path=='/index'||objThis.$route.path=='/login')
    //   {
    //   eventModule.closeApp()
    //   return
    //   }
    //   else
    //   {
    //   objThis.$router.go(-1)
    //   }
    // })
  },
  methods: {
  }
  }
</script>
<style scoped>
  .loading{
    /* position: absolute; */
    position: fixed;
    width: 750px;
    left:0;
    right:0;
    top:0;
    bottom:0;
    background-color: #1b1a20;
    /* opacity:0.5; */
  }
</style>